package com.olympus.hermes.product.bean.dto.category;

import com.olympus.hermes.common.bean.AbstractBeanConvert;
import com.olympus.hermes.product.domain.Category;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;

/**
 * @author Mickey
 * @since 2021/1/16
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class OutputCategoryDTO extends AbstractBeanConvert<OutputCategoryDTO, Category> {

    private Long id;

    private Long parentId;

    private String name;

    private List<OutputCategoryDTO> childCategories;

    @Override
    protected Category doForward(OutputCategoryDTO outputCategoryDTO) {
        return null;
    }

    @Override
    protected OutputCategoryDTO doBackward(Category category) {
        this.setId(category.getId());
        this.setParentId(category.getParentId());
        this.setName(category.getName());
        return this;
    }
}
